feat: use agent description as prompt placeholder#8788
Open
JosXa wants to merge 1 commit intoanomalyco:devfrom
Open
feat: use agent description as prompt placeholder#8788JosXa wants to merge 1 commit intoanomalyco:devfrom
JosXa wants to merge 1 commit intoanomalyco:devfrom
Conversation
- Show agent description in placeholder when available - Fall back to randomized hints for build agent or no description - Implement in both CLI (TUI) and app (web) components - Add .padEnd(70) workaround for text rendering ghosting bug Fixes issue where switching agents caused visual corruption with ghost characters from previous placeholder remaining visible. TODO: Find proper fix for text layout cache invalidation instead of padding workaround.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
JosXa
commented
Jan 16, 2026
| // placeholder remain visible when switching to shorter text. Browser doesn't properly | ||
| // clear cached text layout with truncate/ellipsis CSS. Proper fix would be to force | ||
| // element recreation or use a different rendering approach. | ||
| return `Ask anything... "${PLACEHOLDERS[store.placeholder]}"`.padEnd(70, " ") |
Contributor
Author
There was a problem hiding this comment.
Please advise. I'm not sure how to get around this ghosting of the previous cycle without the padEnd hack:
WindowsTerminal_genyHK2HUT.mp4
Contributor
Author
There was a problem hiding this comment.
Prompted opencode for it and it had no idea after 10 attempts.
JosXa
commented
Jan 16, 2026
| if (params.id) return | ||
| if (params.id || !shouldRotatePlaceholder()) return | ||
| const interval = setInterval(() => { | ||
| setStore("placeholder", (prev) => (prev + 1) % PLACEHOLDERS.length) |
Contributor
Author
There was a problem hiding this comment.
/oc Ah, I suppose we should only increment the placeholder index when we actually saw a placeholder
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements dynamic placeholder hints that display the current agent's description instead of static randomized hints, except in build mode.
Closes #8804
WindowsTerminal_NgMLh7dY26.mp4
Changes
Implementation Details
CLI/TUI (
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx)placeholderTextmemo that reactively returns agent description or randomized hintWeb App (
packages/app/src/components/prompt-input.tsx)placeholderTextmemo with same logic as CLIshouldRotatePlaceholdermemo to control hint rotationKnown Issues & Workarounds
Text Rendering Ghosting Bug
When switching between agents, ghost characters from the previous placeholder could remain visible due to browser/terminal text layout caching.
Workaround: Added
.padEnd(70, " ")to force full-width text rendering which overwrites stale cached text.TODO: This is a temporary fix. Investigate why OpenTUI textarea / browser doesn't invalidate text rendering cache, it should properly flush the input.
Testing
Files Changed
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx(+14, -1)packages/app/src/components/prompt-input.tsx(+23, -4)